package com.ruoyi.depot.mapper;

import java.util.List;

import com.ruoyi.common.api.procuredStorage.dto.ProcuredStorageDto;
import com.ruoyi.depot.domain.ProcuredStorage;
import com.ruoyi.depot.domain.InboundProducts;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 采购入库单Mapper接口
 * 
 * @author ruoyi
 * @date 2023-12-13
 */
@Mapper
public interface ProcuredStorageMapper
{
    /**
     * 查询采购入库单
     * 
     * @param storageId 采购入库单主键
     * @return 采购入库单
     */
    public ProcuredStorage selectProcuredStorageByStorageId(Long storageId);

    /**
     * 查询采购入库单列表
     * 
     * @param procuredStorage 采购入库单
     * @return 采购入库单集合
     */
    public List<ProcuredStorage> selectProcuredStorageList(ProcuredStorage procuredStorage);

    /**
     * 新增采购入库单
     * 
     * @param procuredStorageList 采购入库单
     * @return 结果
     */
    public int insertProcuredStorage(List<ProcuredStorage> procuredStorageList);

    /**
     * 修改采购入库单
     * 
     * @param procuredStorage 采购入库单
     * @return 结果
     */
    public int updateProcuredStorage(ProcuredStorage procuredStorage);

    /**
     * 删除采购入库单
     * 
     * @param storageId 采购入库单主键
     * @return 结果
     */
    public int deleteProcuredStorageByStorageId(Long storageId);

    /**
     * 批量删除采购入库单
     * 
     * @param storageIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteProcuredStorageByStorageIds(Long[] storageIds);

    /**
     * 批量删除入库产品
     * 
     * @param storageIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteInboundProductsByStorageIds(Long[] storageIds);
    
    /**
     * 批量新增入库产品
     * 
     * @param inboundProductsList 入库产品列表
     * @return 结果
     */
    public int batchInboundProducts(List<InboundProducts> inboundProductsList);
    

    /**
     * 通过采购入库单主键删除入库产品信息
     * 
     * @param storageId 采购入库单ID
     * @return 结果
     */
    public int deleteInboundProductsByStorageId(Long storageId);

    /**
     * 查询当天最后一个入库单号
     */
    public String selectLastStorageNumberForUpdate();

    /**
     * 查询入库单是否存在
     * @param code
     * @return
     */
    public int checkStorageNumberExists(@Param("code") String code);

    /**
     * 创建入库单
     * @param procuredStorage
     * @return
     */
    int createStorage(ProcuredStorage procuredStorage);
    /**
     * 根据采购单查询仓库
     *
     * @param ordersId
     */
    ProcuredStorageDto selectWarehouseIdByOrdersId(Long ordersId);
}
